﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NeuralNetworkComponents
{
    public class BipolarSigmoidFunction: IActivationFunction
    {
        public Double Alpha { get; set; }

        public BipolarSigmoidFunction()
            : this(2.0) { }

        public BipolarSigmoidFunction(Double alpha)
        {
            this.Alpha = alpha;
        }

        public Double Function(Double x)
        {
            return ((2 / (1 + Math.Exp(-Alpha * x))) - 1);
        }

        public Double Derivative(Double x)
        {
            Double y = Function(x);
            return (Alpha * (1 - y * y) / 2);
        }

        public Double Derivative2(Double x)
        {
            return 0.0;
        }
    }
}
